#ifndef __DICT__H_H_
#define __DICT__H_H_

#include "stdint.h"

#ifdef __cplusplus
extern "C"
{
#endif

#define DICT_LEN(x) (sizeof(x) / sizeof(x[0]))

	typedef struct
	{
		uint8_t src;
		uint8_t des;
	} dict_u8_type;

	int16_t dict_u8_get(const dict_u8_type *dict, int16_t Len, uint8_t src, uint8_t *des);
	
	int16_t dict_disorder_u8_get(const dict_u8_type *dict, int16_t Len, uint8_t src, uint8_t *des);

	typedef struct
	{
		int8_t src;
		int8_t des;
	} dict_i8_type;

	int16_t dict_i8_get(const dict_i8_type *dict, int16_t Len, int8_t src, int8_t *des);
	
	int16_t dict_disorder_i8_get(const dict_i8_type *dict, int16_t Len, int8_t src, int8_t *des);

	typedef struct
	{
		uint16_t src;
		uint16_t des;
	} dict_u16_type;

	int16_t dict_u16_get(const dict_u16_type *dict, int16_t Len, uint16_t src, uint16_t *des);
	
	int16_t dict_disorder_u16_get(const dict_u16_type *dict, int16_t Len, uint16_t src, uint16_t *des);

	typedef struct
	{
		int16_t src;
		int16_t des;
	} dict_i16_type;

	int16_t dict_i16_get(const dict_i16_type *dict, int16_t Len, int16_t src, int16_t *des);
	
	int16_t dict_disorder_i16_get(const dict_i16_type *dict, int16_t Len, int16_t src, int16_t *des);

	typedef struct
	{
		const char *src;
		const char *des;
	} dict_str_type;
	
	int16_t dict_str_get(const dict_str_type *dict, const char *src);
	
	int16_t dict_orderstr_get(const dict_str_type *dict, int16_t len, const char *src);
	
	void dict_str_sort(dict_str_type *dict, int16_t len);

#ifdef __cplusplus
}
#endif

#endif 
